// StorageDatabase.h: interface for the CStorageDatabase class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_STORAGEDATABASE_H__979BD4D8_A686_4FD4_8FCC_ED05EF595753__INCLUDED_)
#define AFX_STORAGEDATABASE_H__979BD4D8_A686_4FD4_8FCC_ED05EF595753__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Storage.h"

#include "ado.h"

class CStorageDatabase : public CStorage
{
public:
	CStorageDatabase();
	virtual ~CStorageDatabase();
	
	virtual void GetRoles(CCopyableMap<CString,LPCTSTR,CStringItemsArray,CStringItemsArray&> & mapRoles);
	virtual void AddRole(const CString &strRoleName, const CStringItemsArray &arrAdmittanceGatewaysNames);
	virtual void UpdateRole(const CString &strOriginalRoleName, const CString &strNewRoleName, const CStringItemsArray &arrAdmittanceGatewaysNames);
	virtual void DeleteRole(const CString & strRoleName);
	virtual void SetUserGroupDefaultRole(const CString &strGroupName, const CStringItemsArray &arrDefaultRoles);
	virtual void SetUserRole(const CString &strUserName, const CStringItemsArray &arrRolesNames);

	BOOL IsUserExist(const CString &strUserName);
	CStringItemsArray GetUserRoles(const CString &strUserName);
private:
	BOOL Initialize();
	void UpdateUserGroupDefaultRole(const CString &strOriginalRoleName, const CString &strNewRoleName= CString());
	void UpdateUserSpecialRole(const CString &strOriginalRoleName, const CString &strNewRoleName= CString());
	CString m_strConfFilePath;
	CADODatabase * m_pDB;
};

#endif // !defined(AFX_STORAGEDATABASE_H__979BD4D8_A686_4FD4_8FCC_ED05EF595753__INCLUDED_)
